import bus from "@/bus";
import { renderButton, formatDate } from '@/util';
let prevMonth = () => {
  let date = new Date()
  let curMonth = new Date().getMonth() + 1
  let year = null
  let prMonth = null
  if (curMonth == 1) {
    prMonth = 12
    year = date.getFullYear() - 1
  } else {
    prMonth = curMonth - 1
    year = date.getFullYear()
  }
  return year + '-' + prMonth
}
let data = {
  status: 'pass',
  totalItem: 1,
  pageSize: window.$pageSize,
  currentPage: 1,
  form: {
    time: prevMonth(),
    year: '',
    month: '',
    status: '0',
    storeTypeId: null,
    isTask: null,
    addressArr: [],
    areaId: null,
    cityId: null,
    provinceId: null,
    distributorId: null,
    distributorName: '',
    storeId: null,
    storeName: ''
  },
  columns: [{
    title: '门店名称',
    key: 'storeName',
    align: 'left',
    minWidth: 200,
    fixed: 'left',
    tooltip: true
  }, {
    title: '经销商',
    key: 'distributorName',
    align: 'left',
    minWidth: 200
  }, {
    title: '门店类型',
    key: 'storeTypeName',
    align: 'left',
    minWidth: 150
  }, {
    title: '门头编号',
    key: 'storeNo',
    align: 'left',
    minWidth: 200
  }, {
    title: '联系人',
    key: 'storeContactName',
    align: 'left',
    minWidth: 150
  }, {
    title: '所属地区',
    key: 'address',
    align: 'left',
    minWidth: 200
  }, {
    title: '月度指标',
    key: 'purchaseTaskQuantity',
    align: 'right',
    minWidth: 120,
    renderHeader: (h, params) => {
      let oDiv = h('div', [
        h('span', '月度指标'),
        h('Icon', {
          props: {
            type: 'ios-help-circle'
          }
        })
      ])
      return h('Tooltip', {
        style: {
          cursor: 'pointer'
        },
        props: {
          'max-width': "200",
          transfer: true,
          content: '门店月度进货指标'
        }
      }, [oDiv])
    }
  }, {
    title: '完成任务量',
    key: 'totalTaskQuantity',
    align: 'right',
    minWidth: 120
  }, {
    title: '入库总量',
    key: 'totalIncreaseQuantity',
    align: 'right',
    minWidth: 100
  }, {
    title: '退货总量',
    key: 'totalReduceQuantity',
    align: 'right',
    minWidth: 100
  }, {
    title: '进货积分',
    key: 'totalIncreaseIntegral',
    align: 'right',
    minWidth: 100
  }, {
    title: '进货返利',
    key: 'totalIncreaseRebate',
    align: 'right',
    minWidth: 100
  }, {
    title: '月度指标',
    key: 'isTask',
    align: 'left',
    minWidth: 100,
    render: (h, params) => {
      return h('div', params.row.isTask ? '是' : '否')
    }
  }, {
    title: '审定积分',
    key: 'auditIntegral',
    align: 'right',
    minWidth: 100
  }, {
    title: '审定返利',
    key: 'auditRebate',
    align: 'right',
    minWidth: 100
  }, {
    title: '门店创建',
    key: 'storeCreateDate',
    align: 'left',
    minWidth: 200
  }, {
    title: '签约日期',
    key: 'storeSignDate',
    align: 'left',
    minWidth: 200
  }, {
    title: '操作',
    align: 'right',
    minWidth: 100,
    render: (h, params) => {
      return (
        <div>
          {renderButton(h, {text: '明细', type: 'primary'}, () => {bus.$emit("detailRow", {row: params.row})})}
        </div>
      )
    }
  }],
  data: []
}
export default data;
